package com.tarena.lbs.activity.dao.repository.impl;

import com.tarena.lbs.activity.dao.mapper.ActivityMapper;
import com.tarena.lbs.activity.dao.repository.ActivityRepository;
import com.tarena.lbs.activity.pojo.po.ActivityPO;
import com.tarena.lbs.activity.pojo.query.ActivityQuery;
import com.tarena.lbs.activity.pojo.vo.ActivityVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Slf4j
@Repository
public class ActivityRepositoryImpl implements ActivityRepository {
    @Autowired
    private ActivityMapper activityMapper;

    @Override
    public void insert(ActivityPO activity) {
        log.info("----------------{}", activity);
        activityMapper.insertActivity(activity);
    }

    @Override
    public ActivityVO selectByActivityId(Integer id) {
        ActivityVO activity=activityMapper.selectByActivityId(id);
        return activity;
    }

    @Override
    public List<ActivityVO> selectList() {
        List<ActivityVO> list=activityMapper.select();
        return list;
    }

    @Override
    public void updateActivityStatus(ActivityPO activity) {
        activityMapper.updateActivityStatus(activity);
    }

    @Override
    public void delete(Integer id) {
        activityMapper.deleteActivity(id);
    }

    @Override
    public List<ActivityVO> selectActivity(ActivityQuery query) {
        List<ActivityVO> list=activityMapper.selectActivity(query);
        return list;
    }
}
